package com.zd.bms.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

import com.zd.bms.bean.vo.req.BmsRoleReqListVo;
import com.zd.bms.bean.vo.req.RoleMenuTreeVoReqVo;
import com.zd.bms.bean.vo.resp.BmsResourceRespVo;
import com.zd.bms.bean.vo.resp.BmsRoleRespVo;
import com.zd.common.bean.model.BmsResource;
import com.zd.common.bean.model.BmsRole;
import com.zd.common.bean.model.BmsUser;
import com.zd.common.dao.common.Page;
import com.zd.common.service.IBaseService;

public interface IBmsRoleService extends IBaseService<BmsRole>{
	
	/**
	 * 查找所有角色
	 * @return
	 * @throws Exception
	 */
	Page<BmsRoleRespVo> findAllRole(BmsRoleReqListVo reqVo) throws Exception;
	
	/**
	 * 根据是否有角色ID，进行新建角色或修改角色
	 * @return
	 * @throws Exception
	 */
	@Transactional(rollbackFor = Exception.class)
	boolean saveAndUpdateRole(RoleMenuTreeVoReqVo bmsRoleReqVo, BmsUser bmsUser) throws Exception;
	
	/**
	 * 根据角色ID，查询角色信息以及菜单树
	 * @param id
	 * @return
	 * @throws Exception
	 */
	Map<String, Object> findRole(Integer id) throws Exception;
	
	/**
	 * 查询出当前系统所有菜单接口
	 * @return
	 * @throws Exception
	 */
	List<BmsResourceRespVo> findAllResource() throws Exception;
	
	/**
	 *  根据是否有菜单ID，进行新建菜单或修改菜单
	 * @param bmsResource
	 * @return
	 * @throws Exception
	 */
	boolean addOrUpdateResourcet(BmsResource bmsResource, BmsUser bmsUser) throws Exception;
	
	/**
	 * 删除该菜单
	 * @param id
	 * @return
	 * @throws Exception
	 */
	Map<String, Object> delResourcet(Integer id) throws Exception;
	
	/**
	 * 根据用户类型，给出可配置的角色
	 * @param bmsUser
	 * @return
	 * @throws Exception
	 */
	Map<String, Object> findRoleForUser(BmsUser bmsUser) throws Exception;
} 
